# Contributor: Łukasz Jendrysik <scadu@yandex.com>
# Contributor: Carlo Landmeter <clandmeter@alpinelinux.org>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=beets
pkgver=2.0.0
pkgrel=0
pkgdesc="Music library manager and MusicBrainz tagger"
url="https://beets.io"
arch="noarch"
license="MIT"
subpackages="$pkgname-doc $pkgname-zsh-completion $pkgname-pyc"
depends="
	py3-confuse
	py3-jellyfish
	py3-mediafile
	py3-munkres
	py3-musicbrainzngs
	py3-mutagen
	py3-requests
	py3-unidecode
	py3-typing-extensions
	py3-yaml
	python3
	"
checkdepends="py3-pytest py3-pytest-cov"
makedepends="py3-setuptools"
source="https://github.com/sampsyo/beets/releases/download/v$pkgver/beets-$pkgver.tar.gz"
builddir="$srcdir/beets-1.6.1" # XXX: bug with upstream release

build() {
	python3 setup.py build
}

check() {
	# Requires reflink module which is currently not packaged.
	rm -f test/test_files.py

	python3 -m pytest
}

package() {
	python3 setup.py install --skip-build --root="$pkgdir"

	local man
	for man in man/*.?; do
		install -Dm644 "$man" \
			"$pkgdir"/usr/share/man/man${man##*.}/${man##*/}
	done

	install -Dm644 extra/_beet -t "$pkgdir"/usr/share/zsh/site-functions/
}

sha512sums="
c5ec76886b4c0bfb2837441509f69490513c1787db3128fd801dc5abe38d796800515b66228d1b1aedb10a8985b95cb7713516b6a19dfe1670ad3df716723f88  beets-2.0.0.tar.gz
"
